<?php
/**
 * User: aka
 * Time: 20:36
 */

namespace app\write\controller;

use app\validate\goodsEntry\SendGoodsEntry;
use think\Request;

class GoodsEntry
{
    public function sendGoodsEntry(Request $request)
    {
        $validate = new SendGoodsEntry();
        if (!$validate->check($request->param())) {
            return json($validate->getError());
        }else{
            \app\tenno\model\GoodsEntry::create([
                'name' => $request->param('name'),
                'english_name' => $request->param('english_name'),
                'aka' => $request->param('aka'),
                'des' => $request->param('des'),
                'tax' => $request->param('tax'),
                'price' => $request->param('price')
            ]);
            return json([
                'state' => 200
            ]);
        }
    }
}